<template>
  <div>
    <Header />
    <div class="header">
      <div class="header-img">
        <img :src="info.app_list_pic_url" alt="" />
        <div class="img-name">
          <span>{{ info.name }}</span>
        </div>
      </div>
      <div class="header-msg">
        {{ info.simple_desc }}
      </div>
    </div>
    <div class="content" v-if="goodsList.length">
      <div class="box" v-for="item in goodsList" :key="item.id">
        <img :src="item.list_pic_url" alt="" />
        <p class="p1">{{ item.name }}</p>
        <p class="p2">￥{{ item.retail_price }}</p>
      </div>
    </div>
    <div class="null" v-else>数据库暂无数据...</div>
  </div>
</template>

<script>
import Header from "@/components/header/header.vue";
import { detailaction } from "@/api/home/index.js";
export default {
  components: {
    Header,
  },
  data() {
    return {
      info: {},
      goodsList: {},
    };
  },
  created() {
    console.log(this.$route.query.id);
    this.init();
  },
  methods: {
    async init() {
      var result = await detailaction({
        id: this.$route.query.id,
      });
      this.info = result.data;

      this.goodsList = result.goodsList;
      console.log(this.goodsList);
    },
  },
};
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}
html {
  background: #f4f4f4;
}
.header {
  width: 375px;
  .header-img {
    position: relative;
    width: 375px;
    img {
      width: 375px;
      height: 180px;
    }
    .img-name {
      text-align: center;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate3d(-50%, -50%, 0);
      span {
        font-size: 19px;
        padding: 2.5px;
        border-bottom: 2.5px solid #fff;
        color: #fff;
      }
    }
  }
  .header-msg {
    padding: 20px 16px;
    font-size: 15px;
    color: #666;
  }
}
.content {
  background-color: #f4f4f4;
  width: 375px;
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  .box {
    width: 186px;
    background-color: #fff;
    padding: 7.5px 0;
    margin-bottom: 2.5px;
    img {
      width: 151px;
    }
    .p1 {
      margin-top: 7px;
      font-size: 12px;
    }
    .p2 {
      margin: 15px 0;
      font-size: 15px;
      color: #b4282d;
    }
  }
}
.null {
  height: 298px;
  text-align: center;
  font-size: 14px;
  color: #999;
  background-color: #f4f4f4;
  padding-top: 46px;
}
</style>